package org.jc.gateway.enums;

import lombok.Getter;

/**
 * 功能描述
 *
 * @author wanghongqian
 * @date 2024/07/11 21:10
 */
@Getter
public enum ResultCodeEnum {

    SUCCESS(200,"success"),
    FAIL(500,"fail");

    public int code;

    public String desc;

    ResultCodeEnum(int code,String desc){
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(int code){
        for(ResultCodeEnum codeEnum:ResultCodeEnum.values()){
            if(codeEnum.getCode() == code){
                return codeEnum;
            }
        }
        return null;
    }
}
